/*---------------------------
|+++++++++++++++++++++++++++|			
|	   Nguyen Duc Tai		|
|+++++++++_MUTEX_H_+++++++++|
---------------------------*/

#include <pthread.h>

#ifndef _MUTEX_H_
#define _MUTEX_H_

class Mutex 
{
protected:
	pthread_mutex_t mutex_count;
	pthread_cond_t cond_count;
public:
	
	Mutex(){};
	~Mutex();

	//init mutex
	void init();

	//lock mutex
	void lock();

	//unlock mutex
	void unlock();

	//block the calling thread, wait for the signal
	void wait();

	//signal another thread which is waiting on condition 
	void signal();
};
#endif